<template>
  <div class="app-container">
    <div class="backgroundClass">
      <div class="title">
        <div class="titleBox">
          <span class="title_fontSize">个人信息</span>
          <!-- <div style="width:80%" class="titleBoxProgress">
            <progressA :visible='progressVisible' top="70%" :percentage='process' :title='title'></progressA>
          </div> -->
        </div>
        <div class="btn_box">
          <span>
            <el-button
              v-if="http.indexOf('qdjsxy') != -1 || http.indexOf('yzza') != -1"
              type="primary"
              @click="getinvoice"
              >申请发票</el-button
            >
          </span>
          <span>
            <el-button
              type="primary"
              @click="
                () => {
                  this.$router.push('/statistics/index');
                }
              "
              >统计</el-button
            >
          </span>

          <!-- <span>
            <el-button type="primary">操作指南</el-button>
          </span> -->
          <span v-show="showbtnImg">
            <el-button type="primary" @click="openClick">打印证书</el-button>
          </span>
          <span v-if="this.initObj.aboutus">
            <el-button icon="el-icon-bell" type="primary" @click="studentfont"
              >学员公告</el-button
            >
          </span>
        </div>
      </div>
      <div class="top_content">
        <div class="nameAndPick">
          <!-- headPicture?headPicture:'@/assets/logo/weixin.png' -->
          <img v-if="headPicture" :src="headPicture" alt="" />
          <img v-else src="@/assets/logo/logo.png" alt="" />
          <span>{{ nickname }}</span>
        </div>
        <div class="userInfor">
          <ul>
            <li>
              <span>培训科目:</span>
              <el-dropdown
                @command="command"
                trigger="click"
                placement="bottom-start"
                class="dropdownBox"
              >
                <span class="el-dropdown-link">
                  {{ subjectTitleA }}<i class="el-icon-caret-bottom"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item
                    v-for="item in userinfor"
                    :key="item.id"
                    :command="item"
                    :style="{
                      color:subjct==item.subject_id?'#46a6ff':'#333'
                    }"
                  >
                  {{
                      item.subjectTitle
                    }}
                    <!-- <el-radio @click.stop="()=>{}" :label="item.subject_id" v-model="subjct">{{
                      item.subjectTitle
                    }}</el-radio> -->
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </li>
            <!-- <li style="width:300px">
              <span>身份证号:</span>
              <i style="display:inline-block;min-width:150px;">{{adminUserId}}</i>
            </li> -->
            <li style="width: 300px">
              <span>目标学时:</span>
              <i
                ><i style="color: #f5a623">{{ aim_score }}</i
                >学时</i
              >
            </li>
            <li style="width: 160px">
              <span>学习时长:</span>
              <i
                ><i style="color: #175dff">{{ score_current }}</i
                >学时</i
              >
            </li>
            <li style="min-width: 25vw">
              <!-- 学时 -->
              <progressA
                :visible="progressVisible"
                top="30%"
                :percentage="process"
                :title="title"
              ></progressA>
            </li>
          </ul>
          <ul>
            <li>
              <span>最近登录时间:</span>
              <i style="display: inline-block; min-width: 160px">{{
                login_time
              }}</i>
            </li>
            <li style="width: 300px">
              <span>开通时间:</span>
              <i style="display: inline-block; min-width: 150px">{{
                start_time
              }}</i>
            </li>
            <li style="width: 160px">
              <span>会员剩余时间:</span>
              <i>{{ interval }}</i>
            </li>
            <li style="min-width: 25vw" v-if="Jurisdiction.模拟考试 == '显示'">
              <span>考试剩余次数:</span>
              <i>{{ exam_count }}次</i>
            </li>
          </ul>
        </div>
        <!-- <div class="progressBox">
          
        </div> -->
      </div>
    </div>
    <div class="pickBox">
      <ul
        class="pickItem"
        @click="
          () => {
            this.$router.push('/practice/index');
          }
        "
        v-if="Jurisdiction.专项练习 == '显示'"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/zhuanxiang.png" alt="" />
          <span>题库练习</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="
          () => {
            this.$router.push('/simulation/index');
          }
        "
        v-if="Jurisdiction.模拟考试 == '显示'"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/2.png" alt="" />
          <span>模拟考试</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="
          () => {
            this.$router.push('/simulationzs/index');
          }
        "
        v-if="Jurisdiction.正式考试 == '显示'"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/zhengshi.png" alt="" />
          <span v-if="http.indexOf('yingji') != -1">模拟练习</span>
          <span v-else>正式考试</span>
        </li>
      </ul>
      <ul
        v-if="learnisShow"
        class="pickItem"
        @click="
          () => {
            this.$router.push('/curriculum/index');
          }
        "
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/kejian.png" alt="" />
          <span>课程学习</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="
          () => {
            this.$router.push('/questionsSearch/index');
          }
        "
        v-if="
          Jurisdictions.试题搜索 && Jurisdictions.试题搜索.模块展示 == '显示'
        "
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/shiti.png" alt="" />
          <span>试题搜索</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="mineError"
        v-if="Jurisdictions.错题库 && Jurisdictions.错题库.模块展示 == '显示'"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/3.png" alt="" />
          <span>错题集</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="mineCanlt"
        v-if="
          Jurisdictions.收藏题库 && Jurisdictions.收藏题库.模块展示 == '显示'
        "
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/shoucang.png" alt="" />
          <span>收藏</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="
          () => {
            this.$router.push('/practice/index?titleName=`精选题库`');
          }
        "
        v-if="isShowJX"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/jx.png" alt="" />
          <span>精选题库</span>
        </li>
      </ul>
      <ul class="pickItem" @click="baList" v-if="http.indexOf('peixun') != -1">
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/tongji.png" alt="" />
          <span>备案登记表</span>
        </li>
      </ul>
      <ul
        class="pickItem"
        @click="openUpload"
        v-if="http.indexOf('peixun') != -1"
      >
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/kaoshijilu.png" alt="" />
          <span>论文上传</span>
        </li>
      </ul>
      <!-- <ul class="pickItem">
        <li class="pickItemLi">
          <img src="@/assets/littleIcon/1.png" alt="">
          <span>操作指南</span>
        </li>
      </ul> -->
    </div>
    
    <div class="backgroundClass" v-if="learnisShow">
      <courseware ref="courseware"></courseware>
    </div>
    <modelPDF ref="modelPDF"></modelPDF>
    <modelBA ref="modelBA" @seachLeng="seachLeng"></modelBA>
    <uploadFiles ref="uploadFiles" @seachLeng="seachLeng"></uploadFiles>
    <el-dialog
      title="大培训行业选择"
      :visible.sync="showdio"
      width="25%"
      :show-close="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      class="elDialog"
    >
      <p style="line-height: 1.8; font-size: 16px; font-weight: 600">
        请根据您的所在行业选择对应的行业，并输入上您的所在单位信息。
      </p>
      <el-radio-group
        v-model="radioEdit"
        :style="{ display: 'flex', flexDirection: 'column' }"
      >
        <el-radio style="padding: 5px 0" :label="1092">工贸行业</el-radio>
        <el-radio style="padding: 5px 0" :label="1091">危化行业</el-radio>
        <el-radio style="padding: 5px 0" :label="1093">住房建设行业</el-radio>
        <el-radio style="padding: 5px 0" :label="1094">交通运输</el-radio>
        <el-radio style="padding: 5px 0" :label="1095">矿山行业</el-radio>
        <el-radio style="padding: 5px 0" :label="1096">民用爆破</el-radio>
        <el-radio style="padding: 5px 0" :label="1097">烟花爆竹</el-radio>
      </el-radio-group>
      <el-input
        style="margin-top: 15px; width: 70% !important"
        v-model="company"
        placeholder="请输入您所在的公司或工作单位"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="commitEdit">确 定</el-button>
      </span>
    </el-dialog>
    <applyInvoice ref="applyinvoice"></applyInvoice>
  </div>
  <!-- changesubjct -->
</template>

<script>
import applyInvoice from "@/views/pc/applyInvoice.vue";
import { mapGetters } from "vuex";
import progressA from "./components/progress.vue";
import courseware from "../components";
import modelPDF from "@/components/PDF/modelPDF.vue";
import modelBA from "./components/modelBA.vue";
import uploadFiles from "./components/uploadFiles.vue";

import {
  mywrong,
  mycollect,
  getSetting,
  userlearn,
  materialkmlist,
  getQcount,
  changesid,
} from "@/api/admin.js";
import {
  getsubject_id,
  setsubject_id,
  getsubjectTitle,
  setsubjectTitle,
  setapplyid,
  getapplyid,
  setisphoto,
  delisphoto,
  setJurisdiction,
  setGZ,
  getJurisdiction,
  setispay,
  setExectSetting,
  setLearnTime,
  getGender,
  setuserstate,
  getuserstate,
  deluserstate,
  setcurrentInfo,
  getUsername
} from "@/utils/auth";
export default {
  components: {
    progressA,
    courseware,
    modelPDF,
    modelBA,
    uploadFiles,
    applyInvoice,
  },
  computed: {
    ...mapGetters([
      "userAgent",
      "userinfor",
      "adminUserId",
      "nickname",
      "login_time",
      "Jurisdiction",
      "Jurisdictions",
      "headPicture",
      "initObj",
    ]),
  },
  watch: {
    process(val) {
      if (val == 100) {
        this.progressVisible = true;
      } else {
        this.progressVisible = false;
      }
    },
  },
  data() {
    return {
      gz: "",
      subjct: "",
      subjectTitleA: "",
      progressVisible: false, //学时提醒
      process: 0, //学时百分比
      start_time: "", //开通时间
      exam_count: 0, //考试次数
      interval: "", //天数
      aim_score: 20, //目标学时
      score_current: 20, //学习时长
      cfs: "", //初复审
      title: "您的线上培训学习时长已达到32学时，可以进行考试取证", //学时提醒
      zsIsYes: false,
      listhas: {},
      passNum: 0,
      inforMi: {},
      http:
        process.env.NODE_ENV === "development"
          ? process.env.VUE_APP_BASE_API
          : window.location.href.slice(
              0,
              window.location.href.indexOf("/user")
            ),
      showbtnImg: false, //是否展示证书打印按钮
      dengjiList: {},
      lunwenList: [],
      learnisShow: true,
      isShowJX: false,
      radioEdit: "", //修改
      showdio: false,
      company: "",
    };
  },
  created() {
    if (
      JSON.parse(this.initObj.setting) &&
      JSON.parse(this.initObj.setting).downPine
    ) {
      this.showbtnImg =
        JSON.parse(this.initObj.setting).downPine == "是" ? true : false;
    }
    this.subjct =
      getsubject_id() && getsubject_id() != "null"
        ? Number(getsubject_id())
        : this.userinfor[0].subject_id;
    this.subjectTitleA =
      getsubjectTitle() && getsubjectTitle() != "null"
        ? getsubjectTitle()
        : this.userinfor[0].subjectTitle;

    if (getapplyid()) {
    } else {
      setapplyid(this.userinfor[0].applyid);
    }
    let isfaceMack = "";
    if (this.initObj.is_face) {
      isfaceMack = JSON.parse(this.initObj.is_face);
    } else {
      isfaceMack = "";
    }
    let oaa = false;
    this.userinfor.map((item) => {
      if (this.subjct == item.subject_id) {
        oaa = true;
      }
    });
    if (!oaa) {
      this.subjct = this.userinfor[0].subject_id;
      this.subjectTitleA = this.userinfor[0].subjectTitle;
    }
    getQcount({
      subjectid: this.subjct,
      pool: "精选题库",
      applyid: getapplyid(),
    }).then((res) => {
      if (res.code == 200) {
        if (res.data.count > 0) {
          this.isShowJX = true;
        } else {
          this.isShowJX = false;
        }
      }
    });
    this.userinfor.map(async (item) => {
      if (this.subjct == item.subject_id) {
        setsubjectTitle(item.subjectTitle);
        setsubject_id(item.subject_id);
        let exclude_material = item.exclude_material;
        if (exclude_material == "是") {
          this.learnisShow = false;
        } else {
          if (
            this.initObj.exclude_material &&
            this.initObj.exclude_material
              .split(",")
              .indexOf(this.subjct + "") != -1
          ) {
            this.learnisShow = false;
          } else {
            this.learnisShow = true;
          }
        }
        this.getQuest(this.subjct, item.gz);
        this.start_time = item.start_time;

        this.interval = item.interval;
        // this.score = item.score
        // this.score_current = item.score_current
        this.cfs = item.exam_type;
        // this.process = item.process
        setGZ(item.gz);

        this.gz = item.gz;
        let gzlist = [
          "一般工贸",
          "职业卫生",
          "交通运输",
          "全员培训",
          "企业内训",
        ];
        await userlearn({ applyid: item.applyid }).then((res) => {
          if (res.code == 200) {
            this.score_current = res.data.score_current;
            this.aim_score = res.data.aim_score;
            this.process = res.data.process;
            this.inforMi = JSON.parse(JSON.stringify(res.data));
            this.dengjiList =
              res.data.badjb && JSON.parse(res.data.badjb)
                ? JSON.parse(res.data.badjb)
                : {};
            this.lunwenList = res.data.paper ? JSON.parse(res.data.paper) : [];
            this.exam_count =
              item.gz == "一般工贸" || item.gz == "职业卫生"
                ? res.data.exam_count_left
                : res.data.mock_count_left;
                
            setcurrentInfo(JSON.stringify(Object.assign(res.data,{score_loglist:{},grade_info:{}}))) 
            setLearnTime(this.process);
            if (res.data.face_recog == "是") {
              if (isfaceMack && isfaceMack[item.gz]) {
                setisphoto(isfaceMack[item.gz]);
              }
            } else {
              delisphoto();
            }
            if(getuserstate()&&getuserstate()!="undefined"){
              if(JSON.parse(getuserstate()).applyid!=item.applyid){
                deluserstate()
              }
              if(res.data.apply_audit_result.audit_state!=JSON.parse(getuserstate()).audit_state){
                deluserstate()
              }
            }
            if(res.data.apply_audit_result&&(!getuserstate()||getuserstate()=="undefined")){
              let str = ''
              if(res.data.apply_audit_result.audit_state=='审核通过'){
                str = `您的个人信息已经审核通过,请到'个人信息'菜单处下载打印您的登记表`
              }else if(res.data.apply_audit_result.audit_state=='审核不通过'){
                str = `您的个人信息审核未通过,请到'个人信息'菜单处修改您的个人信息并提交`
              }
              this.$alert(str,'个人信息修改提醒',{
                confirmButtonText: '确定',
                showClose:false,
                callback: action => {
                  setuserstate(JSON.stringify(Object.assign(res.data.apply_audit_result,{attachment:res.data.attachment})))
                }
              })
            }
            setispay({
              is_pay:res.data.is_pay,
              test_pay:item.gz=='特种作业'?res.data.test_pay:'是'
            })
            this.alertMsg();
            if (gzlist.indexOf(item.gz) != -1) {
              if (
                this.aim_score <= this.score_current &&
                item.exam_passit == "不及格"
              ) {
                this.title = `您的线上培训学习时长已达到${this.aim_score}学时，可以参加正式考试`;
              } else if (
                this.aim_score <= this.score_current &&
                item.exam_passit == "及格"
              ) {
                this.title = `您已通过正式考试，完成本次培训`;
              }
            } else {
              this.title = `您的线上培训学习时长已达到${this.aim_score}学时`;
            }
            if (isfaceMack && isfaceMack[res.data.gz]) {
              if (
                isfaceMack[res.data.gz].kjface == "开启" ||
                isfaceMack[res.data.gz].mkface == "开启" ||
                isfaceMack[res.data.gz].zsface == "开启" ||
                isfaceMack[res.data.gz].zxface == "开启"
              ) {
                if (!res.data.face && res.data.face_recog == "是") {
                  this.$router.push("/face?desFace=1");
                }
              }
            }
          }
        });
      }
    });
    // this.process = this.userinfor[0].process
    // this.getQuest(this.subjct,this.gz)
    // console.log(this.listhas,'121211')
    if (this.process == 100) {
      this.progressVisible = true;
    }
  },
  methods: {
    getinvoice() {
      this.$refs.applyinvoice.open(this.gz);
    },
    alertMsg(gz) {
      // console.log(this.inforMi,'555');
      // let str = '<p style="margin: 0;width: 100%;text-align: start;">各位学员：</p><p style="text-indent:28px;text-align: justify;margin: 0;">为进一步做好特种设备作业人员培训工作，现已对电梯、起重、锅炉司炉、非金属焊接、气瓶充装、快开门压力容器实操考试题库进行更新，新题库2022年7月19日启用，点击首页实操选学按钮即可进行学习。</p> <p style="text-align: end;margin: 0;">特此告知。</p>'
      if (
        (getsubject_id() == "472" || !this.inforMi.company) &&
        !this.qyType("hzdpx")
      ) {
        this.showdio = true;
      }
      if(!this.qyType("testtjy")){
        this.showdio = false;
      }
    },
    commitEdit() {
      if (!this.radioEdit) {
        return this.$message.error("所选科目不能为空");
      }
      if (!this.company) {
        return this.$message.error("所在公司不能为空");
      }
      changesid({
        applyid: getapplyid(),
        subject_id: this.radioEdit,
        company: this.company,
      }).then((res) => {
        if (res.code == 200) {
          this.$message.success("操作成功");
          location.reload();
          // this.$store.dispatch('user/userInfo')
        } else {
          this.$message.error("操作失败");
        }
      });
    },
   async command(command) {
    // console.log(123,command);
      setsubjectTitle(command.subjectTitle);
      setsubject_id(command.subject_id);
      setapplyid(command.applyid);
      setGZ(command.gz);
      this.gz = command.gz;
      getQcount({
        subjectid: command.subject_id,
        pool: "精选题库",
        applyid: getapplyid(),
      }).then((res) => {
        if (res.code == 200) {
          if (res.data.count > 0) {
            this.isShowJX = true;
          } else {
            this.isShowJX = false;
          }
        }
      });
      let isfaceMack = "";
      if (this.initObj.is_face) {
        isfaceMack = JSON.parse(this.initObj.is_face);
      } else {
        isfaceMack = "";
      }
      // if(isfaceMack&&isfaceMack[command.gz]){
      //   setisphoto(isfaceMack[command.gz])
      // }
      this.subjct = command.subject_id;
      this.subjectTitleA = command.subjectTitle;
      this.start_time = command.start_time;
      this.exam_count =
        command.gz == "一般工贸" || command.gz == "职业卫生"
          ? command.exam_count_left
          : command.mock_count_left;
      this.interval = command.interval;
      // this.score = command.score
      // this.process = command.process
      this.cfs = command.exam_type;
      // if(command.gz=='一般工贸'||command.gz=='职业卫生'){
      //   this.zsIsYes=true
      //   this.$router.options.routes.map(item=>{
      //     if(item.name=='simulation'){
      //       item.children[0].meta.title='正式考试'
      //     }
      //   })
      // }else{
      //   this.zsIsYes=false
      //   this.$router.options.routes.map(item=>{
      //     if(item.name=='simulation'){
      //       item.children[0].meta.title='模拟考试'
      //     }
      //   })
      // }
      let exclude_material = command.exclude_material;
      if (exclude_material == "是") {
        this.learnisShow = false;
      } else {
        if (
          this.initObj.exclude_material &&
          this.initObj.exclude_material.split(",").indexOf(this.subjct + "") !=
            -1
        ) {
          this.learnisShow = false;
        } else {
          this.learnisShow = true;
          this.$nextTick(() => {
            this.$refs.courseware.changesubjct(command.subject_id);
          });
        }
      }
      this.getQuest(this.subjct, command.gz);
      let gzlist = ["一般工贸", "职业卫生", "交通运输", "全员培训", "企业内训"];
     await userlearn({ applyid: command.applyid }).then((res) => {
        if (res.code == 200) {
          this.score_current = res.data.score_current;
          this.aim_score = res.data.aim_score;
          this.process = res.data.process;
          this.inforMi = JSON.parse(JSON.stringify(res.data));
          this.dengjiList =
            res.data.badjb && JSON.parse(res.data.badjb)
              ? JSON.parse(res.data.badjb)
              : {};
          this.lunwenList = res.data.paper ? JSON.parse(res.data.paper) : [];
          setLearnTime(this.process);
          setcurrentInfo(JSON.stringify(Object.assign(res.data,{score_loglist:{},grade_info:{}}))) 
          setispay({
            is_pay:res.data.is_pay,
            test_pay:command.gz=='特种作业'?res.data.test_pay:'是'
          })
          
          if(getuserstate()&&getuserstate()!="undefined"){
            if(JSON.parse(getuserstate()).applyid!=command.applyid){
              deluserstate()
            }else{
              if(res.data.apply_audit_result.audit_state!=JSON.parse(getuserstate()).audit_state){
                deluserstate()
              }
            }
          }
          if(res.data.apply_audit_result&&(!getuserstate()||getuserstate()=="undefined")){
            let str = ''
            if(res.data.apply_audit_result.audit_state=='审核通过'){
              str = `您的个人信息已经审核通过,请到'个人信息'菜单处下载打印您的登记表`
            }else if(res.data.apply_audit_result.audit_state=='审核不通过'){
              str = `您的个人信息审核未通过,请到'个人信息'菜单处修改您的个人信息并提交`
            }
            this.$alert(str,'个人信息修改提醒',{
              confirmButtonText: '确定',
              showClose:false,
              callback: action => {
                setuserstate(JSON.stringify(Object.assign(res.data.apply_audit_result,{attachment:res.data.attachment})))
              }
            })
          }
          if (res.data.face_recog == "是") {
            if (isfaceMack && isfaceMack[command.gz]) {
              setisphoto(isfaceMack[command.gz]);
            }
          } else {
            delisphoto();
          }
          this.alertMsg();
          if (gzlist.indexOf(command.gz)) {
            if (
              this.aim_score == this.score_current &&
              command.exam_passit == "不及格"
            ) {
              this.title = `您的线上培训学习时长已达到${this.aim_score}学时，可以参加正式考试`;
            } else if (
              this.aim_score == this.score_current &&
              command.exam_passit == "及格"
            ) {
              this.title = `您已通过正式考试，完成本次培训`;
            }
          } else {
            this.title = `您的线上培训学习时长已达到${this.aim_score}学时`;
          }
          if (isfaceMack && isfaceMack[res.data.gz]) {
            if (
              isfaceMack[res.data.gz].kjface == "开启" ||
              isfaceMack[res.data.gz].mkface == "开启" ||
              isfaceMack[res.data.gz].zsface == "开启" ||
              isfaceMack[res.data.gz].zxface == "开启"
            ) {
              if (!res.data.face && res.data.face_recog == "是") {
                this.$router.push("/face?desFace=1");
              }
            }
          }
        }
      });
    },
    seachLeng() {
      userlearn({ applyid: getapplyid() }).then((res) => {
        if (res.code == 200) {
          this.dengjiList = res.data.badjb ? JSON.parse(res.data.badjb) : {};
          this.lunwenList = res.data.paper ? JSON.parse(res.data.paper) : [];
        }
      });
    },
    //我的错题
    mineError() {
      mywrong({ subjectid: getsubject_id() }).then((res) => {
        if (res.code == 200) {
          if (res.data.length <= 0) {
            this.$message.error("您还没有错题记录,快去练习吧");
          } else {
            this.$store.commit("SET_TI", res.data);
            this.$router.push(
              "/simulationExam?daan=不显示" +
                "&usererror=错题集" +
                "&jrType=ctks&subjectid=" +
                getsubject_id()
            );
          }
        }
      });
    },
    //我的收藏
    mineCanlt() {
      mycollect({ subjectid: getsubject_id() }).then((res) => {
        if (res.code == 200) {
          if (res.data.length <= 0) {
            this.$message.error("您还没有收藏试题,快去收藏吧");
          } else {
            this.$store.commit("SET_TI", res.data);
            this.$router.push(
              "/simulationExam?daan=不显示" +
                "&usererror=收藏" +
                "&jrType=scsj&subjectid=" +
                getsubject_id()
            );
          }
        }
      });
    },
    //特殊模块权限
    async getQuest(subjectid, gz) {
      await getSetting({ subjectid: subjectid, gz: gz }).then((res) => {
        if (res.code == 200) {
          let obj = res.data;
          let arr = ["初级", "中级", "高级", "技师"];
          this.$store.dispatch("user/commitJurisdictions", res.data);
          if (
            gz == "职业技能等级认定" &&
            (this.http.indexOf("qdjsxy") != -1 ||
              this.http.indexOf("qiye") != -1 ||
              this.http.indexOf("testtjy") != -1)
          ) {
            arr.map((item) => {
              if (this.subjectTitleA.indexOf(item) != -1) {
                this.$store.dispatch("user/commitJurisdiction", {
                  模拟考试: obj.模拟考试[item].模块展示,
                  正式考试: obj.正式考试[item].模块展示,
                  专项练习: obj.专项练习.模块展示,
                  课程学习: this.learnisShow,
                });
                this.obj = res.data.模拟考试[item];
              }
            });
          } else {
            this.$store.dispatch("user/commitJurisdiction", {
              模拟考试: obj.模拟考试.模块展示,
              正式考试: obj.正式考试.模块展示,
              专项练习: obj.专项练习.模块展示,
              课程学习: this.learnisShow,
            });
            this.obj = res.data.模拟考试;
          }
          setExectSetting(Object.assign(this.obj, { 考试类型: "模拟考试" }));
          // if(obj.模拟考试.模块展示=='显示'&&obj.正式考试.模块展示=='显示'&&obj.专项练习.模块展示=='显示'){
          // }else if(obj.模拟考试.模块展示=='显示'){
          //   this.$store.dispatch('user/commitJurisdiction','1')
          // }else if(obj.正式考试.模块展示=='显示'){
          //   this.$store.dispatch('user/commitJurisdiction','2')
          // }else
          // if(obj.专项练习.模块展示=='显示'){
          //   this.$store.dispatch('user/commitJurisdiction','0')
          // }
        }
        // const routerzswhite = ['一般工贸','职业卫生','交通运输','全员培训','企业内训']
        // if(routerzswhite.indexOf(gz)!=-1){
        //   setJurisdiction('2')
        //   this.passNum=2
        // }else{
        //   setJurisdiction('1')
        //   this.passNum=1
        // }
      });
    },
    //打印证书
    async openClick() {
      if (this.process < 100) {
        return this.$message.error("学时不足,不能打印证书!");
      }
      if(this.inforMi.exam_passit!='及格'&&(this.inforMi.gz=='一般工贸'||this.inforMi.gz=='职业卫生')&&getUsername()!='372924199607068671'&&this.http.includes('ataq')){
        return this.$message.error("考试未通过或未参加考试，不能打印证书!");
      }
      this.inforMi.nickname = this.nickname;
      this.inforMi.username = this.adminUserId;
      this.inforMi.gender = getGender();
      this.$refs.modelPDF.open(this.inforMi);
      // await materialkmlist({
      //   msid:getsubject_id(),
      //   applyid: getapplyid(),
      //   cate: '理论',
      // }).then((res)=>{
      //   if(res.code==200){
      //     this.inforMi.score_loglist=res.data?res.data:[]
      //     this.inforMi.nickname = this.nickname
      //     this.inforMi.username = this.adminUserId
      //   }
      // })
    },
    //学员公告
    studentfont() {
      if (!this.initObj.aboutus) return this.$message.error("暂无公告通知");
      this.$alert(this.initObj.aboutus, "标题名称", {
        confirmButtonText: "确定",
        dangerouslyUseHTMLString: true,
      });
    },
    //备案登记表
    baList() {
      console.log(this.dengjiList);
      this.$refs.modelBA.open(this.dengjiList);
    },
    //论文上传
    openUpload() {
      this.$refs.uploadFiles.open(this.lunwenList);
    },
  },
  mounted() {
    if (this.learnisShow) {
      this.$refs.courseware.changesubjct(this.subjct);
    }
  },
};
</script>

<style lang="scss"></style>
<style lang="scss" scoped>
@import "~@/styles/utis.scss";

.title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;

  .titleBox {
    display: flex;
    min-width: 500px;
    .titleBoxProgress {
      // line-height: 32px;
      display: none;
      align-items: center;
    }
  }
  .title_fontSize {
    line-height: 32px;
    font-size: 18px;
  }
  .btn_box {
    // width: 390px;
    display: flex;
    justify-content: space-between;
    span {
      margin-left: 16px;
    }
  }
}
.top_content {
  display: flex;
  // justify-content: space-between;
  .nameAndPick {
    height: 30px;
    min-width: 120px;
    img {
      height: 100%;
      border-radius: 50%;
    }
    span {
      padding: 0 12px;
    }
  }
  .userInfor {
    // width: 70%;
    min-width: 950px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 80px;
    padding-left: 24px;
    flex: 1;
    ul {
      display: flex;
      margin: 0;
      justify-content: space-between;
      .dropdownBox {
        min-width: 160px;
      }
      .el-dropdown-link {
        cursor: pointer;
        background: #fa6400;
        padding: 8px 18px;
        border-radius: 30px;
        color: #fff;
      }
      li {
        min-width: 150px;
        & > span {
          display: inline-block;
          width: 100px;
          text-align: right;
          font-size: 14px;
          color: #999;
          padding-right: 8px;
        }
        & > i {
          font-size: 14px;
        }
      }
    }
  }
  .progressBox {
    width: 25%;
    height: 80px;
    display: flex;
    // align-items: flex-end;
  }
}
.pickBox {
  width: 100%;
  padding: 24px 0;
  display: flex;
  // overflow: auto;
  // &::-webkit-scrollbar{
  //   // width:5px;
  //   height:5px;
  // }
  // &::-webkit-scrollbar-thumb {
  //   border-radius: 15px;
  //   // -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
  //   background: rgba(0,0,0,0.2);
  // }
  // &::-webkit-scrollbar-track {
  //   // -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
  //   border-radius: 0;
  //   background: rgba(0,0,0,0.1);
  // }
  ul {
    margin: 0;
    flex: 1;
  }
  .pickItem {
    // min-width:168px;
    height: 168px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-left: 50px;
    cursor: pointer;
    &:hover {
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    }
    .pickItemLi {
      height: 90px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      img {
        width: 40px;
      }
    }
  }
  .pickItem:first-child {
    margin: 0;
  }
}

@media screen and (max-width: 1690px) {
  .userInfor {
    width: 100%;
  }
  .progressBox {
    display: none !important;
  }
  .titleBoxProgress {
    display: flex !important;
  }
}
.app-container {
  overflow: auto;
  height: 100%;
}

::v-deep {
  .el-radio__input {
    display: none !important;
  }
  .el-input--medium input {
    width: 100% !important;
  }
  .elDialog {
    .el-radio__input {
      display: inline-block !important;
    }
  }
}
</style>
